package com.hospital.demo.controller.zhangweibo;

import com.hospital.demo.model.zhangweibo.Salarymanage;
import com.hospital.demo.service.zhangweibo.SalarymanageService;
import com.hospital.demo.util.ResultUtils;
import com.hospital.demo.util.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(tags = "工资管理接口")
@CrossOrigin
@RestController
@RequestMapping("/SalarymanageController")

public class SalarymanageController {

    @Autowired
    SalarymanageService salarymanageService;

    @ApiOperation("查询全部下发记录")
    @GetMapping("/SelectSalaryAll")
    public ResultVO SelectSalaryAll(Integer page, Integer limit) {

        List<Salarymanage> lists = salarymanageService.SelectAllSalary();

        return ResultUtils.success(lists);
    }
    @ApiOperation("下发工资")
    @PostMapping("/InsertSalary")
    public Map<String,Object> InsertSalary( Salarymanage salarymanage){
        Map<String,Object> map = new HashMap<>();
        Integer Flag=salarymanageService.InsertSalary(salarymanage);
        if(Flag==0){
            map.put("msg","操作失败");
        }else{
            map.put("msg","操作成功");
        }
        return map ;
    }
}
